home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / Starter / Source / InspectorManager.m < prev    next >
Text File  |  1995-06-12  |  2KB  |  106 lines

  1.  
  2. /*     InspectorManager.m
  3.     created by Robert Vasvari - July 1994
  4. */
  5.  
  6. #import "InspectorManager.h"
  7. #import "MenuController.h"
  8. #import "ClockView.h"
  9. #import "AdjFontTextField.h"
  10. #import "Document.h"
  11.  
  12. @implementation InspectorManager
  13.  
  14. - awakeFromNib
  15. {    
  16.     [super awakeFromNib];
  17.       /* set up the textfields */
  18.     [nameText setFontString:"Helvetica"];
  19.     [nameText setAttributes:4 :8
  20.         align:NX_CENTERED
  21.         lines:1];
  22.     [pathText setFontString:"Helvetica"];
  23.     [pathText setAttributes:0 :4
  24.         align:NX_LEFTALIGNED
  25.         lines:2];
  26.     [panel setDocEdited:NO];
  27.     
  28.     return self;
  29. }
  30.  
  31. - updateInspector:sender
  32. {
  33. id doc=[[NXApp delegate] currentDoc];
  34.     
  35.     //printf("in updateInspector\n");
  36.     if(!doc) 
  37.      { name=NULL;
  38.        path=NULL;
  39.        cTime=0;
  40.        mTime=0;
  41.        return self;
  42.      }
  43.      
  44.     /* lets get info from the current document */ 
  45.     [doc getInspectorData:&name :&path :&tag :&cTime :&mTime];
  46.     
  47.     return self;
  48. }
  49.  
  50. - loadDataFor:(int)boxTag
  51. {
  52. /*     this method loads the data into the currently selected
  53.     screen.
  54.  */
  55.     switch(boxTag)
  56.     { case 0:
  57.        [nameText setStringValue:name];
  58.        [pathText setStringValue:path];
  59.        [createClock setLongValue:cTime];
  60.        [modifyClock setLongValue:mTime];
  61.        [tagText setIntValue:tag];
  62.        [panel setTitle:"Screen 1 Inspector"];
  63.        
  64.         break;
  65.       case 1:
  66.          [panel setTitle:"Screen 2 Inspector"];
  67.       break;
  68.       default:fprintf(stderr,"loadDataFor: bad boxTag:%d\n",boxTag);
  69.     }
  70.     return self;
  71. }
  72.  
  73. - getPanelWithScreen:(int)index
  74. {    /* this needed to be overridden to make sure
  75.        updateInspector gets called
  76.      */
  77.     [panel disableFlushWindow];
  78.     [panel disableDisplay];
  79.     [self updateInspector:nil];
  80.     [super getPanelWithScreen:index];
  81.     [panel reenableDisplay];
  82.     [panel display];
  83.     [panel reenableFlushWindow];
  84.     [panel flushWindow];
  85.     return self;
  86. }
  87.  
  88. - windowDidUpdate:sender
  89. {    
  90.     //printf("in Inspector windowDidUpdate\n");
  91.     [panel disableFlushWindow];
  92.     [panel disableDisplay];
  93.     if([panel isVisible]) [self updateInspector:nil];
  94.     
  95.     /* this will call loadData */
  96.     [super windowDidUpdate:sender];
  97.     [panel reenableDisplay];
  98.     [panel display];
  99.     [panel reenableFlushWindow];
  100.     [panel flushWindow];
  101.     return self;
  102. }
  103.  
  104. @end
  105.  
  106.